package com.huawei.hianalytics.hms;

import android.content.Context;
import com.huawei.hianalytics.ab.bc.cd.ab.cd;
import com.huawei.hianalytics.ab.bc.ef.ab;
import com.huawei.hianalytics.ab.bc.kl.fg;
import com.huawei.hianalytics.ab.fg.bc;

public class HiAnalyticsConf {

    public static class Builder {
        String appid;
        Context mContext;
        cd maintData;
        cd operData;

        public Builder(Context context) {
            if (context != null) {
                this.mContext = context.getApplicationContext();
            }
            this.operData = new cd();
            this.maintData = new cd();
        }

        public void create() {
            if (this.mContext == null) {
                ab.de("hmsSdk", "analyticsConf create(): context is null,create failed!");
                return;
            }
            ab.bc("hmsSdk", "Builder.create() is execute.");
            com.huawei.hianalytics.ab.fg.cd cdVar = new com.huawei.hianalytics.ab.fg.cd("_hms_config_tag");
            cdVar.cd(new cd(this.operData));
            cdVar.ab(new cd(this.maintData));
            com.huawei.hianalytics.ab.fg.ab.ab().ab(this.mContext);
            bc.ab().ab(this.mContext);
            ab.ab().ab(cdVar);
            com.huawei.hianalytics.ab.fg.ab.ab().bc(this.appid);
        }

        public void refresh(boolean z) {
            ab.bc("hmsSdk", "Builder.refresh() is execute.");
            cd cdVar = new cd(this.maintData);
            cd cdVar2 = new cd(this.operData);
            com.huawei.hianalytics.ab.fg.cd bc = ab.ab().bc();
            if (bc == null) {
                ab.cd("hmsSdk", "HiAnalyticsInstance.Builder.Refresh(): calling refresh before create. TAG: _hms_config_tag has no instance. ");
                return;
            }
            bc.ab(1, cdVar);
            bc.ab(0, cdVar2);
            if (this.appid != null) {
                com.huawei.hianalytics.ab.fg.ab.ab().bc(this.appid);
            }
            if (z) {
                com.huawei.hianalytics.ab.fg.ab.ab().ab("_hms_config_tag");
            }
        }

        public Builder setAndroidId(String str) {
            ab.bc("hmsSdk", "setAndroidId(String androidId) is execute.");
            this.operData.bc().cd(str);
            this.maintData.bc().cd(str);
            return this;
        }

        public Builder setAppID(String str) {
            ab.bc("hmsSdk", "Builder.setAppID is execute");
            this.appid = str;
            return this;
        }

        public Builder setChannel(String str) {
            ab.bc("hmsSdk", "Builder.setChannel(String channel) is execute.");
            this.operData.ab(str);
            this.maintData.ab(str);
            return this;
        }

        public Builder setCollectURL(int i, String str) {
            ab.bc("hmsSdk", "Builder.setCollectURL(int type,String collectURL) is execute.TYPE : " + i);
            if (!fg.ab(str)) {
                str = "";
            }
            switch (i) {
                case 0:
                    this.operData.bc(str);
                    break;
                case 1:
                    this.maintData.bc(str);
                    break;
                default:
                    ab.cd("hmsSdk", "Builder.setCollectURL(int type,String collectURL): invalid type!");
                    break;
            }
            return this;
        }

        @Deprecated
        public Builder setEnableAndroidID(boolean z) {
            ab.bc("hmsSdk", "Builder.setEnableAndroidID(boolean reportAndroidID) is execute.");
            this.operData.bc().de(z);
            this.maintData.bc().de(z);
            return this;
        }

        @Deprecated
        public Builder setEnableImei(boolean z) {
            ab.bc("hmsSdk", "Builder.setEnableImei(boolean isReportAndroidImei) is execute.");
            this.operData.bc().ab(z);
            this.maintData.bc().ab(z);
            return this;
        }

        public Builder setEnableMccMnc(boolean z) {
            ab.bc("hmsSdk", "Builder.setEnableMccMnc(boolean enableMccMnc) is execute.");
            this.operData.bc(z);
            this.maintData.bc(z);
            return this;
        }

        @Deprecated
        public Builder setEnableSN(boolean z) {
            ab.bc("hmsSdk", "Builder.setEnableSN(boolean isReportSN) is execute.");
            this.operData.bc().bc(z);
            this.maintData.bc().bc(z);
            return this;
        }

        @Deprecated
        public Builder setEnableUDID(boolean z) {
            ab.bc("hmsSdk", "Builder.setEnableUDID(boolean isReportUDID) is execute.");
            this.operData.bc().cd(z);
            this.maintData.bc().cd(z);
            return this;
        }

        public Builder setEnableUUID(boolean z) {
            ab.ab("hmsSdk", "Builder.setEnableUUID() is executed.");
            this.operData.cd(z);
            this.maintData.cd(z);
            return this;
        }

        public Builder setIMEI(String str) {
            ab.bc("hmsSdk", "setIMEI(String imei) is execute.");
            this.operData.bc().ab(str);
            this.maintData.bc().ab(str);
            return this;
        }

        public Builder setSN(String str) {
            ab.bc("hmsSdk", "setSN(String sn) is execute.");
            this.operData.bc().de(str);
            this.maintData.bc().de(str);
            return this;
        }

        public Builder setUDID(String str) {
            ab.bc("hmsSdk", "setUDID(String udid) is execute.");
            this.operData.bc().bc(str);
            this.maintData.bc().bc(str);
            return this;
        }
    }
}
